package com.dxf;

import com.dxf.database.dbDao.DBMetaData;
import com.dxf.database.dbDao.impl.DBMetaDataImpl;
import com.dxf.database.dbInfo.DataBase;
import com.dxf.database.dbInfo.DataBaseFactory;
import com.dxf.entity.Table;
import com.dxf.generator.BuildCode;
import com.dxf.generator.BuildCodeImpl;

import java.io.File;
import java.util.List;

public class Main {

    //模板根路径
    public  static final String templatePath = new File("").getAbsolutePath()+"\\模板";
    //生成根路径
    public static  final String outputPath = "./生成";



    public static void main(String[] args) throws Exception {
        //1 创建代码生成对象,并指定模板路径
        BuildCode buildCode = new BuildCodeImpl(templatePath);
        //2 获取所有模板file对象
        List<File> files = buildCode.scanTemplateFiles(templatePath+"\\.net硬件集成平台模板");

        //3 获取逻辑处理类
        DBMetaData dbMetaData = new DBMetaDataImpl();

        //4 创建DataBase对象从而获取表数据
        DataBaseFactory dataBaseFactory = new DataBaseFactory();
        DataBase database = dataBaseFactory.createDatabase();

        //5 获取表数据
        List<Table> tables = dbMetaData.getTable(database,"device_wangfeng_qks");

        buildCode.execute(outputPath,tables,files);

        System.out.println("生成完成");










    }




}
